home *** CD-ROM | disk | FTP | other *** search
- // HQInfoPanelController.m
- //
- // You may freely copy, distribute, and reuse the code in this example.
- // Apple disclaims any warranty of any kind, expressed or implied, as to its
- // fitness for any particular use.
-
- #import "HQInfoPanelController.h"
-
- #define README_FILE @"README"
- #define README_EXTENSION @"rtf"
-
- @implementation HQInfoPanelController
-
- + (id)sharedInfoPanelController {
- static HQInfoPanelController *sharedInstance = nil;
- if (!sharedInstance) {
- sharedInstance = [[HQInfoPanelController alloc] init];
- }
- return sharedInstance;
- }
-
- - (id)init {
- return [super initWithWindowNibName:@"HQInfo" owner:self];
- }
-
- - (void)windowDidLoad {
- extern const double HQHackMacVersionNumber;
- NSString *readMePath;
-
- [super windowDidLoad];
-
- // It is assumed that versionField comes out of the nib with a format string with one %f which is to be replaced by the version number.
- [versionField setStringValue:[NSString stringWithFormat:[versionField stringValue], HQHackMacVersionNumber]];
-
- // Load up the ReadMe
- readMePath = [[NSBundle bundleForClass:[self class]] pathForResource:README_FILE ofType:README_EXTENSION];
- if (readMePath) {
- [textView replaceCharactersInRange:NSMakeRange(0, [[textView string] length]) withRTF:[NSData dataWithContentsOfFile:readMePath]];
- [textView scrollRangeToVisible:NSMakeRange(0, 0)];
- }
- }
-
- - (void)showWindow:(id)sender {
- NSWindow *window = [self window];
- [window center];
- [super showWindow:sender];
- }
-
- @end
-